/*
* @Author: Josh
* @Date:   2019-01-30 17:30:39
* @Last Modified by:   josh
* @Last Modified time: 2019-01-31 20:42:41
*/
'use strict';

var _mall = require('util/mall.js');

var _address = {
    //获取地址列表
    getAddressList : function(resolve, reject){
        _mall.request({
            url     : _mall.getServerUrl('/shipping/list.do'),
            data    : {
                pageSize : 50
            },
            success : resolve,
            error   : reject
        });
    },
    //新增地址
    save : function(addressInfo, resolve, reject){
        _mall.request({
            url     : _mall.getServerUrl('/shipping/add.do'),
            data    : addressInfo,
            success : resolve,
            error   : reject
        });
    },
    // 更新地址
    update : function(addressInfo, resolve, reject){
        _mall.request({
            url     : _mall.getServerUrl('/shipping/update.do'),
            data    : addressInfo,
            success : resolve,
            error   : reject
        });
    },
    //删除地址
    deleteAddress : function(shippingId, resolve, reject){
        _mall.request({
            url     : _mall.getServerUrl('/shipping/del.do'),
            data    : {
                shippingId : shippingId
            },
            success : resolve,
            error   : reject
        });
    },
    // 获取单条地址信息
    getAddress : function(shippingId, resolve, reject){
        _mall.request({
            url     : _mall.getServerUrl('/shipping/select.do'),
            data    : {
                shippingId : shippingId
            },
            success : resolve,
            error   : reject
        });
    }
};

module.exports = _address;